<!DOCTYPE html>
<html lang="zh">
<head>
  <#assign title="操作日志">
  <#include "/head.html">
</head>
  
<body>
<div class="container-fluid p-t-15">
  
  <div class="row">
    
    <div class="col-lg-12">
      <div class="card">
      
        <div class="card-toolbar clearfix">
          <form id="searchForm" class="form-inline" action="#!" method="post">
            <div class="form-group mb-2 mr-2">
              <input class="form-control" type="text" name="operator" placeholder="操作人员..">
            </div>
            <div class="form-group mb-2 mr-2">
              <input class="form-control" type="text" name="content" placeholder="操作内容..">
            </div>
            <div class="form-group mb-2 mr-2">
              <div class="input-group">
                <input type="text" class="form-control" data-provide="datepicker" name="query[srartDate]" placeholder="开始时间" value="${.now?string('yyyy-MM-dd')}">
                <div class="input-group-prepend input-group-append">
                  <span class="input-group-text">至</span>
                </div>
                <input type="text" class="form-control" data-provide="datepicker" name="query[endDate]" placeholder="结束时间">
              </div>
            </div>
            <a class="btn btn-default mb-2 mr-2" type="button" onclick="refreshTable()"><i class="mdi mdi-magnify"></i> 搜索</a>
            <a class="btn btn-success mb-2 mr-2" type="button" onclick="exportData()"><i class="mdi mdi-export"></i> 导出</a>
            <button class="btn btn-secondary mb-2" type="reset">重置</button>
          </form>
        </div>
      
        <div class="card-body">
          
          <table id="bootstrap-table"></table>
          
        </div>
      </div>
    </div>
    
  </div>
  
</div>

<#include "/footer.html">

<script type="text/javascript">
var prefix = "system/log";
var listUrl = prefix + '/list';

bootstrapTable({
	url: listUrl,
	queryParams: {
		status: '0'
	}, 
    columns: [{
        field: 'id',
        title: '编号'
    }, {
        field: 'businessName',
        title: '业务名称'
    }, {
        field: 'content',
        title: '操作内容'
    }, {
        field: 'operatorName',
        title: '操作人员'
    }, {
        field: 'url',
        title: '请求URI'
    }, {
        field: 'gmtCreate',
        title: '操作时间'
    }, {
        field: 'operate',
        title: '操作',
        formatter: btnGroup,  // 自定义方法
        events: {
            'click .detail-btn': function (event, value, row, index) {
            	detail(row.id, '日志详情');
            }
        }
    }]
});

//操作按钮
function btnGroup() {
    let html =
        '<a type="button" class="btn btn-xs btn-default detail-btn" title="详情" data-toggle="tooltip"><i class="mdi mdi-eye"></i></a>';
    return html;
}

function exportData() {
	layer.confirm('确定按查询条件导出所有记录？', function(index) {
		location = prefix + '/export?fileName=操作日志&status=0&' + $('#searchForm').serializeString();
	    layer.close(index);
	});
}
</script>
</body>
</html>